package de.fhhof.XMLParser;


import java.util.List;
import java.util.Vector;

import org.jdom.Document;
import org.jdom.Element;

public class Bookstore {

	Vector <Book> books = new Vector<Book>();
	
	public Bookstore() {
		super();
	}

	public Bookstore(Document doc) {
		Element root = doc.getRootElement();
		List <Element> bookList= root.getChildren("book");
		for(Element e : bookList){
			addBooks(new Book(e));
		}
	}

	public Vector<Book> getBooks() {
		return books;
	}

	public void addBooks(Book book) {
		books.add(book);
	}

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		
		for (Book b: books){
			sb.append(b.toString() + "\n");
		}
		
		return sb.toString();
			
	}
	
	
	
	
	
}
